#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>

int main(void)
{
	pid_t pid;

	pid = fork();

	if (-1 == pid) {
		perror("Error forking process");
		exit(1);
	}

	if (0 == pid) {
		printf("[%d] Child\n", getpid());
		//execl("/usr/bin/ls", "ls", "-l", NULL);
		execlp("ls", "ls", "-l", NULL);
		perror("Error executing process");
		exit(1);
	} else {
		printf("[%d] Parent\n", getpid());
	}

	wait(NULL);

	return 0;
}
